
public class Restaurant {
        private final ChefTeam chefTeam;
        private final WaiterTeam waiterTeam;

        public Restaurant(int waiterCount, int chefCount) {
                chefTeam = new ChefTeam(chefCount, this);
                waiterTeam = new WaiterTeam(waiterCount, this);
                chefTeam.startWork();
                waiterTeam.startWork();
        }

        public ChefTeam getChefTeam() {
                return chefTeam;
        }

        public WaiterTeam getWaiterTeam() {
                return waiterTeam;
        }

        public void takeOrder(Order order) {
                getWaiterTeam().takeOrder(order);
        }

        public void stop() {
                chefTeam.stop();
                waiterTeam.stop();
        }

}